package com.jsyh.maidu.adapter.home;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.jsyh.maidu.R;
import com.jsyh.maidu.activity.GoodsListActivity;
import com.jsyh.maidu.config.ConfigValue;

/**
 * Created by Administrator on 2017/6/8.
 */

public class ClassifyHolder extends MyBaseViewHolder implements View.OnClickListener{

    private Context context;
    private TextView brands;
    private TextView hot;
    private TextView news;
    private TextView sales;

    public ClassifyHolder(View itemView, final Context context) {
        super(itemView);
        this.context = context;
        hot = (TextView) itemView.findViewById(R.id.home_hot);
        brands = (TextView) itemView.findViewById(R.id.home_brand);
        news = (TextView) itemView.findViewById(R.id.home_news);
        sales = (TextView) itemView.findViewById(R.id.home_sales);
        brands.setOnClickListener(this);
        news.setOnClickListener(this);
        sales.setOnClickListener(this);
        hot.setOnClickListener(this);
    }

    @Override
    public void bindData() {
    }

    @Override
    public void onClick(View view) {
        switch (view.getId())
        {
            case R.id.home_brand:
                Intent intent = new Intent(context, GoodsListActivity.class);
                intent.putExtra("type", ConfigValue.TYPE_BRANDS);
                context.startActivity(intent);
                break;
            case R.id.home_hot:
                Intent hintent = new Intent(context, GoodsListActivity.class);
                hintent.putExtra("type", ConfigValue.TYPE_HOT);
                context.startActivity(hintent);
                break;
            case R.id.home_news:
                Intent nintent = new Intent(context, GoodsListActivity.class);
                nintent.putExtra("type", ConfigValue.TYPE_NEW);
                context.startActivity(nintent);
                break;
            case R.id.home_sales:
                Intent sintent = new Intent(context, GoodsListActivity.class);
                sintent.putExtra("type", ConfigValue.TYPE_ACTIVITY);
                context.startActivity(sintent);
                break;


        }
    }
}
